<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
		<link rel="stylesheet" href="./css/mui.min.css" />
		<link rel="stylesheet" href="css/index.css" />
		<title>闪烁之光</title>
	</head>
	<body>
		<style>
			.body {
				max-width: 750px;
			}

			.login_bg {
				position: absolute;
				top: 1.34rem;
				left: 0;
				width: 7.5rem;
				height: 12.26rem;
				z-index: 2;
				background: url("./images/bdjs.png") top center no-repeat;
				background-size: cover;
			}

			.login_ip {
				position: absolute;
				top: 5.25rem;
				left: 2.65rem;
				height: .5rem;
				border-radius: .5rem;
				width: 3.9rem;
				font-size: .24rem;
				padding: 0 .24rem;
				outline: none;
				border: 0;
				color: #fff;
				background-color: transparent;
				z-index: 2;
			}

			.login_ip.yzm {
				top: 6.1rem;
				border-radius: 0;
			}


			.loginbtn {
				position: absolute;
				top: 7.6rem;
				left: 1rem;
				width: 2.6rem;
				height: 0.8rem;
				z-index: 3;
			}

			.page_back {
				position: absolute;
				top: 7.6rem;
				left: 3.8rem;
				width: 2.6rem;
				height: 0.8rem;
				z-index: 3;
			}


			input {
				background: transparent;
			}

			input::-webkit-input-placeholder {
				/* WebKit browsers */
				color: #fff;
			}

			input:-moz-placeholder {
				/* Mozilla Firefox 4 to 18 */
				color: #fff;
			}

			input::-moz-placeholder {
				/* Mozilla Firefox 19+ */
				color: #fff;
			}

			input:-ms-input-placeholder {
				/* Internet Explorer 10+ */
				color: #fff;
			}

			.login_ip option {
				background-color: #83b9e2;
			}
		</style>
		<div id="body">
			<div class="fullpage">
				<img src="./images/log.png" class="logo"" />
			</div>
			<img src=" ./images/index_bg.jpg" style="width: 100%;" />
				<div class="login_box">
					<div class="login_btns">
						<div class="sjhm"></div>
						<div class="sjmm"></div>
						<div class="jsm"></div>
					</div>
					<div id="login_bg">
						<div class="login_bg">
							<select class="login_ip" name="qf" id="qf">
							</select>
							<select class="login_ip yzm" name="js" id="js">
							</select>

							<div id="login_phone" class="loginbtn"></div>

							<a href="./login.html">
								<div id="page_back" class="page_back"></div>
							</a>
						</div>
					</div>
				</div>

			</div>
			<!-- jQuery v3.5.1 -->
			<script src="./js/jquery.slim.min.js"></script>
			<script src="./js/mui.js"></script>
			<script src="./config.js"></script>
			<script src="./js/storage.js"></script>
			<script src="./js/sgin1.min.js"></script>
			<script src="./js/sign.js"></script>
			<script src="./js/axios.min.js"></script>
			<script src="./js/SY_LOG.min.js"></script>
			<script src="./js/index.js"></script>
			<script>
				$(function() {
					var AllRoleInfo = {
						"symlf_3226": { //区服id
							"server_id": "symlf_3226",
							"server_name": "神圣火焰",
							"role_list": [{
								"role_id": 4691,
								"role_name": "不屈de罗瑞",
								"role_level": 7,
								"reg_time": 1610441947,
								"total_amount": 123123,
								"role_vip_lev": 111
							}]
						},
					}
					//获取玩家所有角色信息
					function getNewAccAllRoleInfo() {

						var loginInfo = storage.getItem("loginInfo")
						if (!loginInfo) {
							window.location.href = "./index.html"
							return
						}
						// var tdata = {
						// 	"symlf_3226": { //区服id
						// 		"server_id": "symlf_3226",
						// 		"server_name": "神圣火焰",
						// 		"role_list": [{
						// 			"role_id": 4691,
						// 			"role_name": "不屈de罗瑞",
						// 			"role_level": 7,
						// 			"reg_time": 1610441947,
						// 			"total_amount": 123123,
						// 			"role_vip_lev": 111
						// 		}]
						// 	},
						// }
						var params = {}
						params["token"] = loginInfo.token;
						params["project_id"] = cfg.project_id;
						params["ts"] = Math.round(new Date() / 1000);
						params["sign"] = sign(params, cfg.secret_sy);

						getApi({
							url: cfg.api_sy + "/account/role/getNewAccAllRoleInfo",
							data: params
						}).then(res => {

							var tdata = res.data;
							AllRoleInfo = res.data;
							for (var qf in tdata) {
								$('#qf').append('<option value="' + tdata[qf].server_id + '">' + tdata[qf]
									.server_name +
									'</option>');

								for (var i = 0; i < tdata[qf].role_list.length; i++) {
									$('#js').append('<option value="' + tdata[qf].role_list[i].role_id + '">' +
										tdata[qf]
										.role_list[i].role_name + '</option>');

								}
							}

							res.data
						})

					}


					$("#login_phone").click(function() {
						var qf = $("#qf option:selected");
						var js = $("#js option:selected");
						var st = AllRoleInfo[qf.index()].role_list[js.index()]
						var params = {}
						params["act_id"] = cfg.act_id;
						params["act_acc_id"] = cfg.accountInfo.act_acc_id;
						params["platform"] = qf.val().split("_")[0];
						params["zone_id"] = qf.val().split("_")[0];
						params["role_id"] = js.val();
						params["role_name"] = js.text();
						params["server_name"] = qf.text();
						params["vip"] = st.role_vip_lev;
						params["role_level"] = st.role_level;
						params["reg_time"] = st.reg_time;
						params["ts"] = Math.round(new Date() / 1000);
						params["sign"] = sign(params, cfg.secret_active);
debugger
						getApi({
							url: cfg.api_active + "/activity/bindAccRole ",
							data: params
						}).then(res => {
							if (res.code === 0) {
								mui.toast("角色绑定成功！")
								setTimeout(function() {
									window.location.href = "./haoyou.html"
								}, 1000)

							}
						})
					})

					https: //test-new-activity.shiyue.com/activity/bindAccRole 

						getNewAccAllRoleInfo()




				})
			</script>
	</body>
</html>